﻿// TestLibDill.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "libdill.h"
#include "assert.h"
#if defined(OS_WINDOWS)
#include <Windows.h>
#endif
static coroutine void worker(int count, const char* text) {
   int i;
   for (i = 0; i != count; ++i) {
       printf("ww in=%s\n", text);
      int rc = msleep(1);
       printf("ww out=%s\n", text);
      // errno_assert(rc == 0 || errno == ECANCELED);
   }
}
static coroutine void worker2(int count, const char* text) {
   int i;
   for (i = 0; i != count; ++i) {
       printf("ww in=%s\n", text);
        int rc = msleep(1);
       printf("ww out=%s\n", text);
       // errno_assert(rc == 0 || errno == ECANCELED);
   }
}
int main() {

   printf("1111\n");
   go(worker(4, "a "));
   printf("22222\n");
  /* go(worker2(2, "b"));
   printf("33333\n");
    go(worker(3, "c"));
    printf("4444\n");
   int rc = msleep(2000);*/
  

   std::cout << "Hello World!\n";
#if defined(OS_WINDOWS)
   Sleep(122222222222222);
#else
   while (true)
   {
       msleep(100);
   }
#endif
   return 0;
}



